$(document).ready(function(){
    $("#btn1").click(function(){
        query();
    });
});

function details(recordId) {

    location.href="http://localhost:8080/userCore/go_to_schedule_details?recordId="+recordId;
}

query();
function query() {
    var inp1=document.getElementById("inp1").value;
    var inp2=document.getElementById("inp2").value;
    $.ajax({
        url :   "schedule/ajaxget",
        type:   "post",
        data:JSON.stringify({
            projectName : inp1,
            selectDate  : inp2,
        }),
        beforeSend: function(request) {
            request.setRequestHeader("token", "eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiIxIiwiaWF0IjoxNTMyNDA4ODMzLCJzdWIiOiIxLHd6eSwwIiwiZXhwIjoxNTMyNDE2MDMzfQ.DEpHIrk2X8U4Un_SdDNiqqPPEYHXX6DYfx_prQ3QIZQ");
        },
        contentType:"application/json;",
        success:function(data){
            goToLogin(data);
            console.log(data);
            if(data==null||data==""||data==undefined){
                $("#content").html("暂无数据");
            }else{
                var content='<table class="bordered" cellspacing="0" border="0"> <thead>\n' +
                    '\n' +
                    '        <tr>\n' +
                    '            <th>项目名称</th>\n' +
                    '            <th>操作/申请人名称</th>\n' +
                    '            <th>操作/申请时间</th>\n' +
                    '            <th>操作</th>\n' +
                    '        </tr>  ';
                var list = data.data;
                for(var i=0;i<list.length;i++){
                    var obj=list[i];

                    content+='<tr>' +
                        '<th>'+obj.projectName+'</th>' +
                        '<th>'+obj.oprUserName+'</th>' +
                        '<th>'+formatDateTime(obj.oprDate)+'</th>' +
                        '<th><a href="javascript:;" onclick="details('+obj.recordId+')">详情</a></th>' +
                        '<tr/>';
                }
                content+='</thead>\n' +
                    '        <tbody id="tbody_$commonName$"></tbody>\n' +
                    '    </table>';

                console.log(content);
                $("#content").html(content);
            }

        }
    });
}